<template>
  <div style="padding:3%">
   <el-form ref="form" :model="form" label-width="80px">
  
  
  <el-form-item label="酒红包清零时间" label-width="120px">
    <el-col :span="11">
      <el-date-picker type="date"   value-format="yyyy-MM-dd" placeholder="选择日期" v-model="form.validTime" style="width: 100%;" :picker-options="pickerOptions0"></el-date-picker>
    </el-col>
 
 
  </el-form-item>
  <el-form-item label="状态" label-width="120px">
    <el-select v-model="form.status" placeholder="请选择状态">
    
      <el-option label="启用" value="1"></el-option>
         <el-option label="停用" value="0"></el-option>
      <!-- <el-option label="已执行" value="2"></el-option> -->
    </el-select>
  </el-form-item>
   <el-form-item >
    <el-button type="primary" @click="onSubmit()" size="mini" style="margin-left:100px">保存</el-button>
 
  </el-form-item>
</el-form>
  </div>
</template>

<script>
import {
queryPacketConfig,savePacketConfig
} from "@/api/cleanHongBaoTime";
export default {
  data() {
    return {
      form: {
          status: '',
          validTime: '',
          uuid:"",
        
        },
            pickerOptions0: { 
         disabledDate(time) {
            return time.getTime() < Date.now() - 8.64e7;//如果没有后面的-8.64e7就是不可以选择今天的 
         }
 },
    };
  },
  mounted() {
   this.queryPacketConfig()
  },
  methods: {
    queryPacketConfig() {
     
      let data = {
      
      };
      queryPacketConfig(data).then(res => {
         this.form.status=String(res.result.status);
            this.form.uuid=res.result.uuid;
         this.form.validTime=res.result.validTime;
      });
    },
     onSubmit(){
     
      savePacketConfig(this.form).then(res => {
       if (res.code == "1") {
              this.$message({
                showClose: true,
                message: res.message,
                type: "success"
              });
           
            } else {
              this.$message({
                showClose: true,
                message: res.message,
                type: "error"
              });
            }
      });
    }, 

  },
 
  
};
</script>
<style  lang="less" scoped>

</style>